<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

<!-- 搜书结果显示页面。搜书结果显示页面。搜书结果显示页面。搜书结果显示页面。 -->
<head>
<title>'searchresult.jsp'</title>
<style type="text/css">
td {
	text-align: center;
}
</style>

</head>

<body>
	<!--没有找到任何结果  -->
	<c:if test="${empty page.list }">
		<h5 align="center">很遗憾，没有找到相关结果</h5>
	</c:if>
	<!-- 有找到结果 -->
	<c:if test="${ not empty page.list }">
		<div align="center">
			<table>
				<tr>
					<td colspan="2">已找到相关结果</td>
				</tr>
				<tr>
					<td style="font-weight: bold ">小说名称</td>
					<td style="font-weight: bold ">作者</td>
				</tr>

				<c:forEach var="novel" items="${page.list }">
					<tr>
						<td><a
							href="${pageContext.request.contextPath }/ShowNovelInfo?novelId=${novel.id }">${novel.name
								}</a></td>
						<td><a
							href="${pageContext.request.contextPath }/ShowUserInfo?author_nickname=${novel.author_nickname } ">${novel.author_nickname
								}</a></td>
					</tr>
				</c:forEach>
			</table>
		</div>
		<div align="center">
			<br />
			当前页：【${page.pagenum }】 &nbsp;
			<c:if test="${page.pagenum>1}">
				<a href="#" onclick="toPage(${page.pagenum-1 })">上一页</a>
			</c:if>
			
			<c:forEach var="pagenum" begin="${ page.startpage}" end="${page.endpage }">
				<a href="#" onclick="toPage(${pagenum })"> [第${pagenum }页] </a>
			</c:forEach>
			
			<c:if test="${page.pagenum<page.pages}">
				<a href="#" onclick="toPage(${page.pagenum+1 })"> 下一页 </a>
			</c:if>
			
			共${page.pages }页，${page.allRecords }条结果。
			 
		    <br/>
			跳到第<input type="text" id="goPage" style="width: 20px;" />页 
			<input type="button" value="go" onclick="goTo()"/>
			
		
		</div>
		
		<!-- 保存着查询的参数 -->
		<div align="center" id="outdiv">
			<input type="hidden" id="params" value="${params }" />
			<input type="hidden" id="pages" value="${page.pages }" />
		</div>
	</c:if>
</body>
</html>
